package 贪心;

/**
 * @ClassName _122买股票的最佳时机II
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2021/12/9 19:46
 * Version 1.0
 **/
public class _122买股票的最佳时机II {
    public int maxProfit(int[] prices) {
        int result = 0;
        for(int i = 0; i < prices.length - 1; i++){
            int num = prices[i + 1] - prices[i];
            if(num > 0){
                result += num;
            }
        }
        return result;
    }
}
